﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Security;

using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenFaq.Core;
using OpenFaq.Core.UserModule;

namespace OpenFaq.Application.Tests
{
	[TestClass]
	public class Learningtest : TestBase
	{
		

		[TestMethod]
		public void TransactionScope_Nested_DoesNotThrowMSDTCException()
		{
			using (var context = new OpenFaqContext())
			{
				User user = context.Users.FirstOrDefault(usr => usr.Username == "test");
			}

			using (var context = new OpenFaqContext())
			{
				User user = context.Users.FirstOrDefault(usr => usr.Username == "test");
			}
		}


		[TestMethod]
		public void Regex_ForPasswordNonAlphanumericCount()
		{
			string password = "ABcd12*&ab)";
			int nonAlpahNumericCharsCount = Regex.Matches(password, "[^a-zA-Z0-9]").Count;

			Assert.AreEqual(nonAlpahNumericCharsCount, 3);
		}
	}
}
